<template>
  <div ref="box" style="width:600px; height:400px" />
</template>

<script>
import * as Echarts from 'echarts'
import radarData from './radarData'

export default {
  name: 'Radar',
  data() {
    return {

    }
  },
  mounted() {
    this.echarts = Echarts.init(this.$refs.box)
    // 绘制内容
    this.echarts.setOption(radarData)
  },
  created() {
    this.initData()
  },
  methods: {
    // 获取初始化数据
    initData() {
      setTimeout(() => {
        // 模拟ajax
        const value1 = [10, 100, 100, 5, 100, 0]
        const value2 = [30, 50, 80, 100, 100, 100]
        // 修改配置
        radarData.series[0].data[0].value = value1
        radarData.series[0].data[1].value = value2
        // 重新绘制
        this.echarts.setOption(radarData)
      }, 2000)
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
